
$(function () {
    var vue = new Vue({
        el: '#content',
        data: {
            newPhone: '',   // 手机号
            infoCode: '',   // 短信验证码
            passWord: '', // 新密码
        },
        methods: {
            // 获取短信验证码
            gainCode: function () {
                var _newPhone = this.newPhone;
                if(_newPhone.length == ''){
                    layer.msg("手机号不能为空");
                    return;
                }
                else if (!(/^1[3|4|5|7|8][0-9]{9}$/.test(_newPhone))){
                    layer.msg("手机号错误");
                    return;
                }
                else if ((/^170[0-9]{8}$/.test(_newPhone))){
                    layer.msg("很抱歉，受服务限制您的手机号无法注册")
                    return;
                }

                // 倒计时
                var time = 60;
                $('.get-code').hide();
                $('.count-down').show();
                $('.count-down em').html(time)
                var iCount = setInterval(function () {
                    if( time > 0) {
                        time --;
                        $('.count-down em').html(time)
                    } else {
                        clearInterval(iCount);
                        $('.get-code').show();
                        $('.count-down').hide();
                    }
                },1000);

            },
        }
    });
})
